package sh.wn36.vehiclemanage.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import sh.wn36.vehiclemanage.service.OssService;
import sh.wn36.vehiclemanage.util.Result;

@Api(value = "文件上传")
@CrossOrigin
@RestController
@RequestMapping("/serviceoss")
public class OssController {
    @Autowired
    private OssService ossService;
    @ApiOperation(value = "上传文件")
    @PostMapping
    public Result uploadFile(@ApiParam(value = "前端传递到后端的文件") MultipartFile file){
        String url = ossService.doFileUpLoad(file);
        return Result.OK().data("url",url);
    }
}